﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy2Object : EnemyObject
{
    public AudioSource moveAudio;
    // Start is called before the first frame update
    protected new void Start()
    {
        slot.gridManager.Player.ListAdd(this);
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    protected override void OnDestroy()
    {
        base.OnDestroy();
        slot.gridManager.Player.ListRemove(this);
    }

    private int chargeTime = 1;
    public override bool MoveToPlayer() {
        if(chargeTime > 0) {
            chargeTime--;
            return false;
        }
        var dr = slot.gridManager.MoveToPlayer2(this);
        if(dr.Item1 == 0 && dr.Item2 == 0)
            return false;
        moveAudio.Play();
        Move((int)dr.Item1, (int)dr.Item2);
        chargeTime = 1;
        return true;
    }
}
